<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app="myApp" ng-controller="customersCtrl">
<header>{{myHeader}}</header>
<script type="text/javascript">
    var app = angular.module('myApp', []);
    app.controller('customersCtrl', function($scope, $location,$http,$timeout,$interval) {
        $scope.myUrl = $location.absUrl();
        console.log($scope);
        console.log($location);
        // http 请求
        $http.get('angular_get.php').then(function (response) {
            console.log(response.data);
        });
        $http.post('angular_get.php').then(function (response) {
            console.log(response.data);
        });
        //倒计时
        $timeout(function () {
            $scope.myHeader = "How are you today?";
        },2000)
        //间隔执行,window.setInterval
        var num=0;
        $interval(function () {
            num++;
            console.log('你好啊,没人理我说第'+num+'次了啊');
        },1000)
    });
</script>
</body>
</html>